$(function () {
    $('#pwd')
        .blur(function () {
            const pwd = $(this).val()
            if (pwd.length == 0) return
            if (/[a-zA-Z]\d{7}/.test(pwd) == false) {
                $('#yz').show()
            }
        })
        .focus(function () {
            $('#yz').hide()
        })
    $('#btn').click(function () {
        let user = sessionStorage.getItem('username')
        console.log(user);
        let username=JSON.parse(user)[0].username
        console.log(username);
        const pwd=$('#pwd').val()
        const params = {username,pwd}
        console.log(params);
        var url = `http://127.0.0.1:3000/updatepwd`
        $.post(url, params, data => {
            console.log(data);
            if (data.code == 200) {
                alert('密码已修改成功')
            } else {
                alert('密码修改失败')
            }
        })
    })
})